
cmake_minimum_required( VERSION 2.6 )

project( NANE )

option( ENABLE_UNIT_TESTS "compile unit tests" ON )
option( NANE_ASSERTION_ENABLED "assertion checks" ON )
option( NANE_BUILD_SCRIPTSYSTEM "build nane script system" ON )
option( NANE_BUILD_SERIALIZESYSTEM "build nane serialization system" ON )
option( NANE_BUILD_WINDOWSYSTEM "build nane window system" ON )
option( NANE_BUILD_RENDERSYSTEM "build nane render system" ON )
option( NANE_BUILD_SOUNDSYSTEM "build nane sound system" ON )
option( NANE_BUILD_INPUTSYSTEM "build nane input system" ON )
option( NANE_BUILD_FILEARCHIVESYSTEM "build nane file archive system" ON )
option( NANE_BUILD_IMAGECODECSYSTEM "build nane image codec system" ON )
option( NANE_BUILD_SOUNDCODECSYSTEM "build nane sound codec system" ON )

include( cmake/macro.cmake )
include( cmake/defaults.cmake )

if( WIN32 )
    include( cmake/windows.cmake )
elseif( ANDROID )
    include( cmake/android.cmake )
elseif( UNIX )
    include( cmake/linux.cmake )
endif()

include( cmake/user.cmake )

add_subdirectory( thirdparty )
link_directories( ${NANE_BINARY_DIR}/thirdparty/lib )

include_directories( 
${NANE_SOURCE_DIR}/..
 )

add_definitions(-DNANE_STATIC_LIB)

set( NANE_LIBS )
set( NANE_MODULES_DECLARATION )
set( NANE_MODULES_IMPLEMENTATION )

include_directories( thirdparty/cml )
add_subdirectory( core )
if( NANE_BUILD_SCRIPTSYSTEM )
    add_subdirectory( ScriptSystem )
endif()
if( NANE_BUILD_SERIALIZESYSTEM )
    add_subdirectory( SerializeSystem )
endif()
if( NANE_BUILD_WINDOWSYSTEM )
    add_subdirectory( WindowSystem )
endif()
if( NANE_BUILD_RENDERSYSTEM )
    add_subdirectory( RenderSystem )
endif()
if( NANE_BUILD_SOUNDSYSTEM )
    add_subdirectory( SoundSystem )
endif()
if( NANE_BUILD_INPUTSYSTEM )
    add_subdirectory( InputSystem )
endif()
if( NANE_BUILD_FILEARCHIVESYSTEM )
    add_subdirectory( FileArchiveSystem )
endif()

if( NANE_BUILD_IMAGECODECSYSTEM OR NANE_BUILD_SOUNDCODECSYSTEM )
    add_subdirectory( CodecSystem )
endif()

if( NANE_BUILD_IMAGECODECSYSTEM )
    add_subdirectory( CodecSystem/Image )
endif()

if( NANE_BUILD_SOUNDCODECSYSTEM )
    add_subdirectory( CodecSystem/Sound )
endif()


add_subdirectory( lib )

if( ENABLE_UNIT_TESTS )
    add_subdirectory( unittests )
endif()

add_subdirectory( testframework )

message( STATUS "compile unit tests ${ENABLE_UNIT_TESTS}" )
message( STATUS "assertion checks ${NANE_ASSERTION_ENABLED}" )
foreach( subsystem ${NANE_SUBSYSTEMS} )
    message( STATUS "${subsystem}: " )
    if( NANE_${subsystem}_IMPL )
        message( STATUS "    built-in: ${NANE_${subsystem}_IMPL}" )
    endif()
    if( NANE_${subsystem}_SHARED_IMPL )
        message( STATUS "    shared: ${NANE_${subsystem}_SHARED_IMPL}" )
    endif()
endforeach()

include(CPackConfig.cmake)
include(CPack)
